package main;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import com.spider.SpiderExecuterService;
import com.spider.queue.SpiderBlockQueue;
import com.spider.task.SpiderJobDetailTask;

public class GetEmail implements Runnable {

	/**
	 * @param args
	 */
	public void getEmail() {
		ExecutorService spiderPool = Executors.newFixedThreadPool(4);//SpiderExecuterService.getExecutePool();
		while(true){
			spiderPool.execute(new SpiderJobDetailTask());
			if(SpiderBlockQueue.jobBeanQueue.isEmpty() && SpiderBlockQueue.jobBeanQueue2.isEmpty()){
				try {
					Thread.sleep(2000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}
	}

	public void run() {
		getEmail();
	}

}
